﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using ClientSide.ServiceReference1;
using System.ServiceModel;

namespace ClientSide
{
    public partial class Calc : PhoneApplicationPage
    {
      CalculatorClient client;
        public Calc()
        {
          InitializeComponent();
          client = new CalculatorClient(new BasicHttpBinding(), new EndpointAddress("http://localhost:8080/calculator"));
          client.AddCompleted += new EventHandler<AddCompletedEventArgs>(client_AddCompleted);
        }

        void client_AddCompleted(object sender, AddCompletedEventArgs e)
        {
          Result.Text = e.Result;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                float a_v = float.Parse(A_value.Text);
                Result.Text = (a_v + float.Parse(B_value.Text)).ToString();
            }
            catch { }
        }
    }
}
